<template>
	<view>
		<view class="bbsItem"
			v-for="(item,index) in bbsList"
			:key="index"
			@tap="goBbsDet(item.id)"
		>
			<view class="hasFlex">
				<view class="userHead defBg">
					<image class="samePar" :src="getUrl(item.portrait)"></image>
				</view> 
				<view class="bbsCon">
					<view class="userName spaceBet">
						<view class="name">{{item.realName}}</view>
						<view class="jhTag" v-if="item.bestMofitfflag == 1 || item.topFlag == 1">
							<text v-if="item.bestMofitfflag == 1">精华</text>
							<template v-if="item.topFlag == 1">
								<text class="lineView"></text>
								<text>置顶</text>
							</template>
						</view>
					</view>
					<view class="bbsTopic hasBold">{{item.motifName}}</view>
					<view class="pubTime">{{item.sendTime}}</view>
					<view class="botFix hasFlex">
						<!-- <view class="fixItem active" @tap="supportOrNot(index,item.id,0)">
							<text class="iconfont icon-cai"></text>
							<text>{{item.unSupport}}</text>
						</view> -->
						<view class="fixItem active" @tap.stop="supportOrNot(index,item.id,1)">
							<text class="iconfont icon-zan"></text>
							<text>{{item.support}}</text>
						</view>
						<view class="fixItem active" @tap.stop="goFavor(index,item.id)">
							<text class="iconfont icon-shoucangon"></text>
							<text>{{item.concern}}</text>
						</view>
						<view class="fixItem active" @tap.stop="goBbsDet(item.id)">
							<text class="iconfont icon--pinglun"></text>
							<text>{{item.replyCount}}</text>
						</view>
					</view>
				</view>
			</view>
			<template v-if="fromPage == 'myBbsPage' && typeId == 1">
				<view class="cancelFavor" @tap.stop="cancelFavor(item.id)">取消收藏</view>
			</template>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			bbsList:Array,
			fromPage:{
				type:String,
				default:'listDetPage'
			},
			typeId:{
				type:Number,
				default:0
			}
		},
		computed:{
			getUrl(url){
				return function(url){
					if(url.startsWith( 'Module' )){
						return this.zhuXueServer + '/' + url
					}else{
						return url;
					}
				}
			}
		},
		methods:{
			cancelFavor(id){
				this.$emit('cancelFavor',id);
			},
			supportOrNot(index,id,support){
				this.$emit('supportOrNot',index,id,support);
			},
			goFavor(index,id){
				this.$emit('goFavor',index,id);
			},
			goBbsDet(id){
				this.$emit('goBbsDet',id);
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/static/scss/bbsList.scss';
	.cancelFavor{
		text-align: center;
		border-top: 1rpx solid #eee;
		color: $pss-text-color8;
		margin: 20rpx 0 -20rpx;
		@include respTo(phone){
			font-size: $font-size30;
			height: 80rpx;
			line-height: 90rpx;
		}
		@include respTo(pad){
			height: 70rpx;
			line-height: 70rpx;
			font-size: $padSize18;
		}
	}
</style>